Skip to content

Add SI5351_NO_VCXO opt-out for flash savings - #118

Merged
NT7S merged 1 commit into
masterfrom
cursor/vcxo-optout
Nov 8, 2026
Merged

NT7S merged 1 commit into
masterfrom
cursor/vcxo-optout

Conversation

@NT7S

@NT7S NT7S commented Nov 8, 2026

Copy link
Copy Markdown
Member

Adds a sketch-level opt-out for the VCXO code path. It works the same way as the CLK6/7 opt-out from #117.

#define SI5351_NO_VCXO   // before the include, in the .ino
#include <si5351.h>

-DSI5351_NO_VCXO as a compiler flag works too. This combines with SI5351_NO_CLK67.

Changes

  • set_vcxo, the pull-range check and the register 162–164 write are now weak. The header stubs replace them when the opt-out is set.
  • set_vcxo now returns uint8_t: 0 on success, 1 when nothing was written. The opt-out stub always returns 1.
  • reset() still clears registers 162–164.
  • Without the define, register output is byte-identical to 47f14bd and v2.4.2.
  • README section added. New flash budgets min_runtime_sketch_no_vcxo (10,428) and both-opt-outs (9,390). Both fail on 47f14bd.

Uno flash (bytes)

Sketch Baseline No-VCXO Both opt-outs
min_const 10140 9700 9298
min_runtime 10868 10428 9390

Verification

These were re-run independently on a separate box at d66c44b, with arduino-cli 1.5.1 and arduino:avr 1.8.6.

  • run_v231_checks.sh --require-fixed: OVERALL PASS (38 PASS, 2 INFO).
  • equiv_vs_v242: 0 differing runs.
  • prove_v242_negative.sh: PASS.
  • Flash budgets: ALL PASS. The new budget fails on 47f14bd, as intended.

Arduino IDE users cannot pass per-sketch compiler flags, and a #define in
the sketch did not reach si5351.cpp. set_vcxo, the pull-range test, and the
VCXO parameter write are weak. When a sketch defines SI5351_NO_VCXO before
#include <si5351.h>, the header stubs replace them and the linker drops the
originals. -DSI5351_NO_VCXO still works, including together with
SI5351_NO_CLK67. set_vcxo returns 0 after it writes registers and 1 when it
writes nothing.

Default builds stay 0 differing runs vs v2.4.2 and keep the Uno ceilings.
The sketch opt-out saves 440 bytes; the compiler flag saves 472.

Uno flash (arduino-cli 1.5.1, arduino:avr 1.8.6): min_runtime 10868
default, 10428 with the sketch #define, 10396 with the flag. Adds
min_runtime_sketch_no_vcxo (10428) and min_runtime_sketch_no_clk67_no_vcxo
(9390). Both fail on 47f14bd.

Co-authored-by: Jason Milldrum <NT7S@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Memory usage change @ d66c44b

Board flash % RAM for global variables %
arduino:avr:uno 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
esp32:esp32:esp32 🔺 +40 - +48 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 🔺 +28 - +36 +0.01 - +0.01 0 - 0 0.0 - 0.0
rp2040:rp2040:rpipico 🔺 +16 - +24 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/si5351_calibration
flash
% examples/si5351_calibration
RAM for global variables
% examples/si5351_clk67_example
flash
% examples/si5351_clk67_example
RAM for global variables
% examples/si5351_example
flash
% examples/si5351_example
RAM for global variables
% examples/si5351_ext_ref
flash
% examples/si5351_ext_ref
RAM for global variables
% examples/si5351_outputs
flash
% examples/si5351_outputs
RAM for global variables
% examples/si5351_phase
flash
% examples/si5351_phase
RAM for global variables
% examples/si5351_sweeper
flash
% examples/si5351_sweeper
RAM for global variables
% examples/si5351_vcxo
flash
% examples/si5351_vcxo
RAM for global variables
%
arduino:avr:uno 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
esp32:esp32:esp32 44 0.0 0 0.0 44 0.0 0 0.0 40 0.0 0 0.0 44 0.0 0 0.0 44 0.0 0 0.0 40 0.0 0 0.0 44 0.0 0 0.0 48 0.0 0 0.0
arduino:samd:mkrzero 28 0.01 0 0.0 28 0.01 0 0.0 28 0.01 0 0.0 28 0.01 0 0.0 28 0.01 0 0.0 28 0.01 0 0.0 28 0.01 0 0.0 36 0.01 0 0.0
rp2040:rp2040:rpipico 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 24 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 24 0.0 0 0.0
Click for full report CSV
Board,examples/si5351_calibration<br>flash,%,examples/si5351_calibration<br>RAM for global variables,%,examples/si5351_clk67_example<br>flash,%,examples/si5351_clk67_example<br>RAM for global variables,%,examples/si5351_example<br>flash,%,examples/si5351_example<br>RAM for global variables,%,examples/si5351_ext_ref<br>flash,%,examples/si5351_ext_ref<br>RAM for global variables,%,examples/si5351_outputs<br>flash,%,examples/si5351_outputs<br>RAM for global variables,%,examples/si5351_phase<br>flash,%,examples/si5351_phase<br>RAM for global variables,%,examples/si5351_sweeper<br>flash,%,examples/si5351_sweeper<br>RAM for global variables,%,examples/si5351_vcxo<br>flash,%,examples/si5351_vcxo<br>RAM for global variables,%
arduino:avr:uno,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
esp32:esp32:esp32,44,0.0,0,0.0,44,0.0,0,0.0,40,0.0,0,0.0,44,0.0,0,0.0,44,0.0,0,0.0,40,0.0,0,0.0,44,0.0,0,0.0,48,0.0,0,0.0
arduino:samd:mkrzero,28,0.01,0,0.0,28,0.01,0,0.0,28,0.01,0,0.0,28,0.01,0,0.0,28,0.01,0,0.0,28,0.01,0,0.0,28,0.01,0,0.0,36,0.01,0,0.0
rp2040:rp2040:rpipico,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,24,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,24,0.0,0,0.0

@NT7S
NT7S merged commit 3ca004c into master Nov 8, 2026
9 checks passed
@NT7S NT7S mentioned this pull request Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants